import React, { Component } from 'react';
import { Row, Col, Input, Icon,Form, Cascader, DatePicker, Button, Tooltip, Popconfirm } from 'antd';

import{BasicFormItem} from './BasicFormItem';

 class BasicForm extends Component{
    constructor(props) {
        super(props);
        this.state = {
        };
    }

    render(){
        let self = this;
        let schemaJson = [];
        let intiState = [];
        let dataJson = [];
        let isNew =false;
        let propform = this.props.form;
        let editing = self.props.editing;
        let ruleJson = {validateDict: null, eventDict: null};
        let objectEditDto ={id:'Emp0000000005',type:'E'}
        let stepKeycode ='HRMB0011';
        let  listRows = 3;
        schemaJson = [
        {canEdit:true,className:'col-xs-6',code:'ContractNo',dataSourceParameter:null,
        dataType:0, defaultValue:null,editMode:'1',isRequired:false,linkFieldCode:null,
        localizationName:'合同编号',matchExpression:null,max:null,maxLength:20,
        min:null,minLength:null,selectedItemList:[],sortIndex:0,validateExpression:null},

        {canEdit:true,className:'col-xs-6',code:'ContractName',dataSourceParameter:null,
        dataType:0, defaultValue:null,editMode:'1',isRequired:false,linkFieldCode:null,
        localizationName:'合同名称',matchExpression:null,max:null,maxLength:20,
        min:null,minLength:null,selectedItemList:[],sortIndex:1,validateExpression:null}];

        // schemaJson.orderBy(function (m) {
        //     return m.sortIndex;
        // });

        ruleJson = {eventDict:{},validateDict:{}}
        
        intiState = {
            "vid": '',
            "Begin":  new Date(),
            "End":  '9999-12-31'
        };
        return(<div>
            <Form>
                <Row  className="section">{ schemaJson.map(function (schema, index) {
                                  return (<BasicFormItem key={index}
                                                         schema={schema}
                                                         intistate={intiState}
                                                         infosetcode={stepKeycode}
                                                         propform={propform}
                                                         rootComponent={self}
                                                         rule={ruleJson}
                                                         editing={editing}
                                                         objectEditDto={objectEditDto}
                                                         Rows={listRows}
                                                         rootForm={self}
                                                         isNew={isNew}/>
                                    )
                                }
                            )
                        }
                </Row>
               
            </Form>

            </div>)
    }
}


BasicForm = Form.create()(BasicForm);
export {
    BasicForm as BasicForm
}